package cn.secby.goods.domain;

import java.math.BigDecimal;
import java.time.LocalDateTime;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.baomidou.mybatisplus.annotation.IdType;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
import com.baomidou.mybatisplus.annotation.*;
import cn.secby.common.core.annotation.Excel;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import cn.secby.common.core.web.domain.BaseEntity;

/**
 * 规格对象 tb_sku
 * @author shenkunlin
 * @date 2025-05-06
 */
@Data
@AllArgsConstructor
@NoArgsConstructor
@Builder
@TableName(value = "tb_sku")
public class Sku extends BaseEntity
{
    private static final long serialVersionUID = 1L;

    /** 主键ID */
    @TableId(value ="id" ,type = IdType.ASSIGN_ID )
    @JsonSerialize(using=ToStringSerializer.class)
    private Long id;

    /** 规格编码 */
    @Excel(name = "规格编码")
    @TableField(value = "sku_code")
    private String skuCode;

    /** 商品ID */
    @TableField(value = "spu_id")
    private Long spuId;

    /** 规格属性 */
    @Excel(name = "规格属性")
    @TableField(value = "spec_attributes")
    private String specAttributes;

    /** 可售库存 */
    @Excel(name = "可售库存")
    @TableField(value = "stock")
    private Integer stock;

    /** 价格 */
    @Excel(name = "价格")
    @TableField(value = "price")
    private Long price;

    /** 成本价 */
    @Excel(name = "成本价")
    @TableField(value = "cost_price")
    private Long costPrice;

    /** 条形码 */
    @Excel(name = "条形码")
    @TableField(value = "bar_code")
    private String barCode;

    /** 重量(kg) */
    @Excel(name = "重量(kg)")
    @TableField(value = "weight")
    private BigDecimal weight;

    /** WMS系统对应skuId */
    @Excel(name = "WMS系统对应skuId")
    @TableField(value = "wms_sku_id")
    private Long wmsSkuId;

    /** 是否同步 */
    @Excel(name = "是否同步")
    @TableField(value = "wms_sync_status")
    private Integer wmsSyncStatus;

    /** 最后同步时间 */
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @Excel(name = "最后同步时间", width = 40, dateFormat = "yyyy-MM-dd")
    @TableField(value = "sync_time")
    private LocalDateTime syncTime;

    /** 状态 */
    @Excel(name = "状态")
    @TableField(value = "status")
    private Integer status;

    /** 来源 */
    @TableField(value = "sku_source")
    private Integer skuSource;

    /** 是否删除 */
    @Excel(name = "是否删除")
    @TableField(value = "is_delete")
    @TableLogic(value = "1", delval = "2")
    private Integer isDelete;

}
